import django_filters
from django.shortcuts import render
from goods import models,serializers
# Create your views here.
from rest_framework import viewsets
from django_filters.rest_framework import FilterSet,DjangoFilterBackend
class Sea(FilterSet):
    name = django_filters.CharFilter(lookup_expr='contains',field_name="name")
    class Meta:
        model = models.Goods
        fields = ['name']

class GetGood(viewsets.ModelViewSet):
    queryset = models.Goods.objects.all()
    serializer_class = serializers.Goods
    filter_backends = [DjangoFilterBackend]
    filterset_class = Sea


class GetShop(viewsets.ModelViewSet):
    queryset = models.Shop.objects.all()
    serializer_class = serializers.Shop

